<?php
// +-------------+------------------+------+-----+---------+----------------+
// | Field       | Type             | Null | Key | Default | Extra          |
// +-------------+------------------+------+-----+---------+----------------+
// | id          | int(11)          | NO   | PRI | NULL    | auto_increment |
// | name        | varchar(80)      | YES  |     |         |                |
// | title       | varchar(30)      | YES  |     |         |                |
// | status      | tinyint(1)       | YES  |     | 1       |                |
// | condition   | varchar(200)     | YES  |     |         |                |
// | icon        | varchar(50)      | YES  |     |         |                |
// | islink      | tinyint(1)       | YES  |     | 0       |                |
// | sort        | int(11)          | YES  |     | 0       |                |
// | tips        | varchar(50)      | YES  |     |         |                |
// | member_id   | int(11) unsigned | YES  |     | 0       |                |
// | create_time | int(11) unsigned | YES  |     | 0       |                |
// | update_time | int(11) unsigned | YES  |     | 0       |                |
// | parent_id   | int(11) unsigned | YES  |     | 0       |                |
// | controller  | varchar(50)      | YES  |     |         |                |
// | action      | varchar(50)      | YES  |     |         |                |
// +-------------+------------------+------+-----+---------+----------------+
namespace app\admin\validate;

use think\Validate;

class AuthRule extends Validate
{
    protected $rule = [
        // "name" => "max:50",
        "controller" => "max:30",
        "action" => "max:30",
        "title" => "min:2|max:30",
        "condition" => "max:200",
        "icon" => "max:50",
        "tips" => "max:50",
    ];

    protected $field = [
        "name"  => "规则名",
        "controller"  => "规则名",
        "action"  => "规则名",
        "title"  => "菜单名",
        "condition"  => "菜单条件",
        "icon"  => "菜单小标",
        "tips"  => "菜单Tip",
    ];

    protected $message = [
        "name.min" =>  "路由规则长度不能超过50个字符",
        "name.max" => "路由规则长度必须在2-30个字符之间",
        "controller.max" => "页面控制器名长度不能超过30个字符",
        "action.max" => "页面方法名长度不能超过30个字符",
        "title.min" => "菜单名长度必须在2-30个字符之间",
        "title.max" => "菜单名长度必须在2-30个字符之间",
        "condition.max" => "菜单条件长度不能超过200个字符",
        "icon.max" => "菜单小标长度不能超过50个字符",
        "tips.max" => "菜单Tip长度不能超过50个字符",
    ];
}